import java.util.*;
/**
 * Created with IntelliJ IDEA
 * Description:
 * User: Administrator
 * Data: 2023 - 09 - 26
 * Time: 10:38
 */
//牛客 倒置字符串
public class Solution5 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextLine()) { // 注意 while 处理多个 case
            String str = in.nextLine();
            char[] arr = str.toCharArray();
            int len = arr.length;
            reverse(arr, 0, len - 1);
            int i = 0;
            while(i < len) {
                int j = i;
                while(j < len && arr[j] != ' ') {
                    j++;
                }
                if(j < len) {
                    reverse(arr, i, j - 1);
                    i = j + 1;
                }else {
                    reverse(arr, i, j - 1);
                    i = j;
                }
            }
            String s = new String(arr);
            System.out.println(s);
        }
    }
    public static void reverse(char[] arr, int start, int end) {
        while(start < end) {
            char temp = arr[start];
            arr[start] = arr[end];
            arr[end] = temp;
            start++;
            end--;
        }
    }
}
